<template>
  <div class="MyPonit_box">
    <div class="account_box_text1">{{ $t("button.MyPoint") }}</div>
    <div class="account_box_text2"></div>
    <div class="MyPonit_box_child1">
      {{ $t("button.level") }}
      <span style="color: #00aef0"
        >{{ $t("button.Level1") }}{{ tableData.grade }}{{ $t("button.Level1s")
        }}{{ tableData.count }}</span
      >
    </div>
    <div class="MyPonit_box_child2">
      <div class="MyPonit_box_childs">
        <div class="MyPonit_box_child2_text1">
          {{ $t("button.TOTAL") }}
        </div>
        <div class="MyPonit_box_child2_text3">{{ $t("button.POINT1") }}</div>
        <div class="MyPonit_box_child2_text2">{{ tableData.money }}</div>
      </div>
      <div class="MyPonit_box_child2_text4"></div>
      <div class="MyPonit_box_childs">
        <div class="MyPonit_box_child2_text1" style="margin-top: 0px">
          {{ $t("button.Main") }}
        </div>
        <div class="MyPonit_box_child2_text3">{{ $t("button.POINT1") }}</div>
        <div class="MyPonit_box_child2_text2" style="font-size: 24px">
          {{ tableData.main_money }}
        </div>
      </div>
      <div class="MyPonit_box_childs">
        <div class="MyPonit_box_child2_text1">
          {{ $t("button.Avatar") }}
        </div>
        <div class="MyPonit_box_child2_text3">{{ $t("button.POINT1") }}</div>
        <div class="MyPonit_box_child2_text2" style="font-size: 24px">
          {{ tableData.avatar_money }}
        </div>
      </div>
      <div class="MyPonit_box_child2_text4"></div>
      <div class="MyPonit_box_childs">
        <div class="MyPonit_box_child2_text1">
          {{ $t("button.available") }}
        </div>
        <div class="MyPonit_box_child2_text3">{{ $t("button.POINT1") }}</div>
        <div
          class="MyPonit_box_child2_text2"
          style="font-size: 24px; color: #00aef0"
        >
          {{ tableData.available }}
        </div>
      </div>
      <div class="MyPonit_box_childs">
        <div class="MyPonit_box_child2_text1">
          {{ $t("button.Points") }}
        </div>
        <div class="MyPonit_box_child2_text3">{{ $t("button.POINT1") }}</div>
        <div
          class="MyPonit_box_child2_text2"
          style="font-size: 24px; color: #00aef0"
        >
          {{ tableData.accumulate }}
        </div>
      </div>
    </div>
    <div class="MyPonit_box_child3">{{ $t("button.history") }}</div>
    <div class="table_text">
      <el-table :data="tableDataCurrent" border style="width: 100%">
        <el-table-column prop="date" :label="$t('button.Date')">
        </el-table-column>
        <el-table-column prop="type" :label="$t('button.Level')">
        </el-table-column>
        <el-table-column prop="money" :label="$t('button.POINTsL')">
        </el-table-column>
        <el-table-column prop="withdraw_money" :label="$t('button.Available')">
        </el-table-column>
        <el-table-column prop="shopping_money" :label="$t('button.Accumulate')">
        </el-table-column>
        <el-table-column prop="status" :label="$t('button.Action8')">
          <span style="color: #ccc">{{ "complete" }}</span>
        </el-table-column>
      </el-table>
      <el-pagination
        style="text-align: center; margin: 20px 0"
        background
        v-show="tableData.data.total > 0"
        :total="tableData.data.total"
        :page.sync="listQuery.page"
        :page-size="listQuery.limit"
        :size.sync="listQuery.limit"
        @current-change="getLists"
        layout="total,prev, pager, next"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { port } from "@/api/user.js"; //  积分赠送 会员积分购买记录
export default {
  data() {
    return {
      tableDataCurrent: [],
      data: {
        name: "MyPonit",
      },
      query: {
        user_id: "", // 用户id
        page: 1, // 当前页面
      },
      tableData: {},
      listQuery: {
        // Dang当前页
        page: 1,
        // 每页多少条
        limit: 3,
      },
    };
  },
  created() {
    this.query.user_id = sessionStorage.getItem("id");
    this.port(this.query);
  },
  methods: {
    // 记录状态
    formatterposttype(row) {
      return row.status == 0 ? "未审核" : row.status == 1 ? "审核通过" : "拒绝";
    },
    // 分页
    getLists(val) {
      console.log(val);
      this.loadings = true;
      this.tableDataCurrent = this.tableData.data.data.slice(
        (val - 1) * this.listQuery.limit,
        val * this.listQuery.limit
      );
      console.log((this.listQuery.page - 1) * this.listQuery.limit);
      console.log(this.listQuery.page * this.listQuery.limit);
      this.loadings = false;
      console.log(this.tableDataCurrent);
    },
    // 会员详情
    async port(query) {
      try {
        const data = await port(query);
        this.tableData = data.data;
        console.log(this.tableData);
        this.getLists(1);
        console.log(data);
      } catch (error) {
        console.log(error);
      }
    },
  },
};
</script>

<style scoped>
.el-table {
  font-size: 20px;
}
::v-deep .el-table .el-table__cell {
  padding: 20px 0 !important;
}
.table_text {
  margin: 75px 142px 0;
}
::v-deep .el-pagination span:not([class*="suffix"]) {
  font-size: 22px;
  line-height: 44px;
}
::v-deep .btn-prev {
  text-align: center;
  line-height: 33px;
  width: 44px !important;
  height: 44px !important;
}
::v-deep .btn-next {
  text-align: center;
  line-height: 33px;
  width: 44px !important;
  height: 44px !important;
}
::v-deep .el-pager li {
  font-size: 20px;
  text-align: center;
  line-height: 44px;
  width: 44px !important;
  height: 44px !important;
}
.MyPonit_box {
  box-sizing: border-box;
  width: 100%;
  height: 922px;
  background: #ffffff;
}
.account_box_text1 {
  margin: 62px 0 0 132px;
  height: 42px;
  font-size: 56px;
  font-family: Arial;
  font-weight: bold;
  color: #1a1a1a;
}
.account_box_text2 {
  margin: 53px 0 0 0;
  width: 1918px;
  height: 2px;
  background: #bfbfbf;
}
.MyPonit_box_child1 {
  margin: 20px 0 0 132px;
  height: 29px;
  font-size: 30px;
  font-family: Arial;
  font-weight: 400;
  color: #666666;
}
.MyPonit_box_child2 {
  margin: 39px 0 0 135px;
  width: 1077px;
  height: 312px;
  border: 2px solid #bfbfbf;
  border-radius: 20px;
}
.MyPonit_box_childs {
  margin-top: 18px;
}
.MyPonit_box_child2_text1 {
  display: inline-block;
  margin: 0 0 0 38px;
  height: 18px;
  font-size: 24px;
  font-family: Arial;
  font-weight: 400;
  color: #666666;
}
.MyPonit_box_child2_text2 {
  float: right;
  margin: 0 0 0 0;
  height: 18px;
  font-size: 30px;
  font-family: Arial;
  font-weight: 500;
  color: #1a1a1a;
}
.MyPonit_box_child2_text3 {
  float: right;
  margin: 0 223px 0 0;
  height: 18px;
  font-size: 24px;
  font-family: Arial;
  font-weight: 400;
  color: #666666;
}
.MyPonit_box_child2_text4 {
  margin: 18px 0 0;
  width: 1076px;
  height: 2px;
  background: #bfbfbf;
}
.MyPonit_box_child3 {
  margin: 52px 0 0 152px;
  height: 28px;
  font-size: 30px;
  font-family: Arial;
  font-weight: bold;
  color: #1a1a1a;
  line-height: 110px;
}
</style>